#ifndef COMMONUTILS_H
#define COMMONUTILS_H
#include <string>
#include <fstream>
#include <qdatetime.h>
#include <Entry.h>
using namespace std;
class CommonUtils
{
	static const string _fileName;
public:
	CommonUtils(void);
	~CommonUtils(void);

	enum DISPLAY_FORMAT{
		DISPLAY_FORMAT_DEFAULT,
		DISPLAY_FORMAT_NEW,
		DISPLAY_FORMAT_CLASH,
		DISPLAY_FORMAT_COMPLETED
	};
	
	enum COMMAND_TYPE{
		COMMAND_ADD,
		COMMAND_DELETE,
		COMMAND_SET_DONE,
		COMMAND_EDIT,
		COMMAND_DISPLAY,
		COMMAND_DISPLAY_ALL,
		COMMAND_SORT,
		COMMAND_SEARCH,
		COMMAND_UNDO,
		COMMAND_REDO,
		COMMAND_DISPLAY_TASK,
		COMMAND_DISPLAY_EVENT,
		COMMAND_DISPLAY_WEEK,
		COMMAND_DISPLAY_DAY,
		COMMAND_DISPLAY_DAY_BEFORE,
		COMMAND_DISPLAY_PAST_NOT_DONE,
		COMMAND_CLEAR,
		COMMAND_DISPLAY_DONE,
		COMMAND_DISPLAY_NOT_DONE,
		COMMAND_EXIT,
		COMMAND_INVALID
	};

	struct ReturnCount{
		int numOverdue;
		int numToday;
		int numFuture;
		int numTasks;
		int numEvents;
	};
	
	struct ReturnString{
		pair<string,string> entry;
		DISPLAY_FORMAT format;
	};

	struct ReturnStatus{
		vector<vector<CommonUtils::ReturnString>> displayMsg;
		string statusMsg;
	};	
	static const QTime TIME_MIDNIGHT;
	static const string STRING_COMMAND_ADD;
	static const string STRING_COMMAND_DELETE;
	static const string STRING_COMMAND_SET_DONE;
	static const string STRING_COMMAND_EDIT;
	static const string STRING_COMMAND_DISPLAY;
	static const string STRING_COMMAND_DISPLAY_ALL;
	static const string STRING_COMMAND_SORT;
	static const string STRING_COMMAND_SEARCH;
	static const string STRING_COMMAND_UNDO;
	static const string STRING_COMMAND_REDO;
	static const string STRING_COMMAND_DISPLAY_TASK;
	static const string STRING_COMMAND_DISPLAY_EVENT;
	static const string STRING_COMMAND_DISPLAY_WEEK;
	static const string STRING_COMMAND_DISPLAY_DAY;
	static const string STRING_COMMAND_DISPLAY_DAY_BEFORE;
	static const string STRING_COMMAND_DISPLAY_PAST_NOT_DONE;
	static const string STRING_COMMAND_CLEAR;
	static const string STRING_COMMAND_DISPLAY_DONE;
	static const string STRING_COMMAND_DISPLAY_NOT_DONE;
	static const string STRING_COMMAND_EXIT;
	static const string ENTRY_TYPE_EVENT;
	static const string ENTRY_TYPE_TASK;
	static const QString FORMAT_DATE;
	static const QString FORMAT_TIME;
	static string toLower(string);
	static bool greater(const Entry*,const Entry*);
	static Entry* compareEntry(Entry*,Entry*);
	static Entry* compareByType(Entry*, Entry* );
	static Entry* compareByStartDate(Entry*,Entry*);
	static Entry* compareByStartTime(Entry*,Entry*);
	static Entry* compareByEndTime(Entry*,Entry*);
	static Entry* compareByEndDateTime(Entry*, Entry*);
	static Entry* compareByName(Entry*,Entry*);
	static Entry* compareByStatus(Entry*,Entry*);
};

#endif